package com.sand.cloud.consumer.controller;



import com.sand.cloud.consumer.feignClient.ProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {
    @Autowired
    private DiscoveryClient discoveryClient;
    @Autowired
    private ProviderClient providerClient;

    @GetMapping("/consumer")
    public ResponseEntity<Object> consumer() {
        return ResponseEntity.ok(providerClient.provider());
    }

    @GetMapping("/clients")
    public ResponseEntity<Object> clients() {
        return ResponseEntity.ok(discoveryClient.getServices());
    }

}
